import java.util.Random;
import java.util.Scanner;

import static org.junit.Assert.assertEquals;

public class NGuessNumberTest {
    public void generateAnswerTest() {
        System.out.println("请输入4个0-9之间的数字:");
        Random ran = new Random();


        Integer s;
        s = ran.nextInt(9999 - 1000 + 1) + 1000;


        while (true) {

            String str = s.toString();
            int[] shuijishu = new int[4];
            for (int i = 0; i < str.length(); i++) {
                Character ch = str.charAt(i);
                shuijishu[i] = Integer.parseInt(ch.toString());
            }
            Scanner sc = new Scanner(System.in);
            Integer q = sc.nextInt();

            String newq = String.valueOf(q);
            int qLangth = newq.length();
            if (qLangth != 4) {
                System.out.println("你输入的数字不是4位，请重新输入：");
                break;
            } else {
                String str1 = q.toString();
                int[] newq1 = new int[4];
                for (int i = 0; i < newq1.length; i++) {
                    Character ch = str1.charAt(i);
                    newq1[i] = Integer.parseInt(ch.toString());
                }

            }
        }
    }

    public void getPlayerInputTest() {
        int numsize = 4;

        NGuessNumber nGuessNumber = new NGuessNumber();

        assertEquals(numsize, nGuessNumber.guesslist.toString());

        System.out.println("用户输入的数字数量为4，正确");
    }

    public void  isWin(){
        NGuessNumber nGuessNumber = new NGuessNumber();

        if(nGuessNumber.isWin()==true){
            assertEquals(true,nGuessNumber.isWin());
            System.out.println("根据提示信息中A的数量判断玩家是否获胜，如果获胜返回true，否则返回" +
                    "false，返回结果类型正确");
        }else if(nGuessNumber.isWin()==false){
            assertEquals(false,nGuessNumber.isWin());
            System.out.println("根据提示信息中A的数量判断玩家是否获胜，如果获胜返回true，否则返回false，返回结果类型正确");
        }else{
            assertEquals(true,nGuessNumber.isWin());
            assertEquals(false,nGuessNumber.isWin());
            System.out.println("根据提示信息中A的数量判断玩家是否获胜，如果获胜返回true，否则返回false，返回结果类型错误");

        }
    }
}